package com.vo;


import com.entity.Source;

import java.util.ArrayList;
import java.util.List;

public class SourceGroupVO {

    private String parentModule;
    private String childModule;
    private boolean checked = true;
    private boolean virtual;
    private List<Source> sourceList;

    public SourceGroupVO(String parentModule, String childModule) {
        this.parentModule = parentModule;
        this.childModule = childModule;
    }

    public String getParentModule() {
        return parentModule;
    }

    public void setParentModule(String parentModule) {
        this.parentModule = parentModule;
    }

    public String getChildModule() {
        return childModule;
    }

    public void setChildModule(String childModule) {
        this.childModule = childModule;
    }

    public boolean getChecked() {
        if (null != sourceList && sourceList.size() > 0) {
            for (Source source : sourceList) {
                if (!source.isChecked()) {
                    checked = false;
                    break;
                }
            }
        }
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public boolean isVirtual() {
        return virtual;
    }

    public void setVirtual(boolean virtual) {
        this.virtual = virtual;
    }

    public List<Source> getSourceList() {
        if (null == sourceList) {
            sourceList = new ArrayList<Source>();
        }
        return sourceList;
    }

    public void setSourceList(List<Source> sourceList) {
        this.sourceList = sourceList;
    }
}